<?php

class Application_Model_Category
{
	protected $_category_id;
	protected $_abbrev;
	protected $_category;
	
    public function __construct(array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }

    public function __set($name, $value)
    {
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid category property');
        }
        $this->$method($value);
    }

    public function __get($name)
    {
        $method = 'get' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid category property');
        }
        return $this->$method();
    }

    public function setOptions(array $options)
    {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }
    
	public function setCategory_id($id)
    {
        $this->_category_id = (string) $id;
        return $this;
    }

    public function getCategory_id()
    {
        return $this->_category_id;
    }

    public function setAbbrev($abbrev)
    {
        $this->_abbrev = (string) $abbrev;
        return $this;
    }

    public function getAbbrev()
    {
        return $this->_abbrev;
    }
    
	public function setCategory($category)
    {
        $this->_category = (string) $category;
        return $this;
    }

    public function getCategory()
    {
        return $this->_category;
    }
}

